<!DOCTYPE html>
<html ng-app="app">
<head>
    <title>Simple app</title>

    <script type="text/javascript" src="lib/angular.js"></script>

</head>
<body>
<div ng-controller="FirstController">
    <h4>The simplest adding machine ever</h4>
    <button ng-click="add(1)" class="button">Add</button>
    <a ng-click="subtract(1)" class="button alert">Subtract</a>
    <h4>Current count: {{ counter }}</h4>
</div>

<script type="text/javascript">
    var app = angular.module('app', []); //此处的app等价于2行 app
    console.info(app.name);
    console.info(app.requires);
    app.controller('FirstController', function ($scope) {
        $scope.counter = 0;
        $scope.add = function (amount) {
            $scope.counter += amount;
        };
        $scope.subtract = function (amount) {
            $scope.counter -= amount;
        };
    });
</script>
</body>
</html>